package cn.edik.kit;

import java.util.prefs.Preferences;

public class ConfigKit {

    private static Preferences sysData = Preferences.systemNodeForPackage(ConfigKit.class);

    public static Boolean put(ConfigKey key, String value) {
        try {
            sysData.put(key.toString(), value);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public static String get(ConfigKey key, String def) {
        return sysData.get(key.toString(), def);

    }

    public static Boolean putBoolean(ConfigKey key, Boolean value) {
        try {
            sysData.putBoolean(key.toString(), value);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public static Boolean getBoolean(ConfigKey key, Boolean def) {
        return sysData.getBoolean(key.toString(), def);
    }
}
